<% form_for(@pro_image,:url=>product_pro_images_path(params[:product_id]),:html=>{:multipart=>true}) do |f| %>
  <%= f.error_messages %>
  <p>
    <%= f.label :image %><br />
    <div id="img">
      <input  type="file" name="img[0]" accept="image/gif,image/jpeg,image/png"/><br/>
    </div>
    <br/>
    <a href="#" id="addmore">添加更多</a>
    <%= hidden_field_tag :img_type_id,"2" %>

  </p>
  <p>
    <%= f.submit "Create" %>
  </p>
<% end %>
<script type="text/javascript">
  $(document).ready(function(){
    $("#addmore").click(function(){
      for(var i=0; i<5; i++)
      {
        $("#img").append("<input  type='file' name='img["+(i+1)+"]' accept='image/gif,image/jpeg,image/png'/><br/>");
      }
    });
  });
</script>

